﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace InformationExtraction.Common
{
    class Line : TokenSequence
    {
        public Line()
        {
            Tokens = new List<Token>();

            Prior = null;
            Next = null;
        }

        /// <summary>
        /// 是否满足键值对形式. XXX:YYYYYYYY
        /// </summary>
        public bool IsKeyValue
        {
            get;
            set;
        }

        /// <summary>
        /// 是否以标点符号结束
        /// </summary>
        public bool IsEndWithPunctuation
        {
            get;
            set;
        }

        /// <summary>
        /// 是否为分隔符行（无字母信息）, 如："======="
        /// </summary>
        public bool IsSeperaterLine
        {
            get;
            set;
        }

        /// <summary>
        /// 是否为空行
        /// </summary>
        public bool IsEmpty
        {
            get;
            set;
        }

        /// <summary>
        /// 所在文档
        /// </summary>
        public Document InDocument
        {
            get;
            set;
        }

        /// <summary>
        /// 下一行
        /// </summary>
        public Line NextLine
        {
            get
            {
                return (Line)Next;
            }
            set 
            {
                Next = value;
            }
        }

        /// <summary>
        /// 上一行
        /// </summary>
        public Line PriorLine
        {
            get
            {
                return (Line)Prior;
            }
            set
            {
                Prior = value;
            }
        }

        public override Object Clone()
        {
            Line line = new Line();

            line.RawContent = RawContent;
            line.Content = Content;
            line.IsParagraphEnd = IsParagraphEnd;
            line.IsParagraphHeader = IsParagraphHeader;
            line.Next = Next;
            line.Tokens = Tokens;

            line.No = No;
            line.IsSeperaterLine = IsSeperaterLine;
            line.IsKeyValue = IsKeyValue;
            line.IsEmpty = IsEmpty;

            return line;
        }

        public override string ToString()
        {
            return RawContent;
        }

    }
}
